import React from "react";
import {Button, Grid} from "@material-ui/core";
import {AddRounded, CloudDownloadRounded} from "@material-ui/icons";

import {EnhancedTable, Toolbar} from "../../../shared/components"
import {renderEditDeleteActions} from "../../../shared/utilities/uiTemplate.util";

const IncidentReport = (props) => {

    return (
        <Grid container spacing={4}>
            <Toolbar
                title="Incident History"
                actions={<React.Fragment>
                    <Button
                        variant="contained"
                        color="primary"
                        startIcon={<AddRounded/>}
                    >
                        Create Incident
                    </Button>
                </React.Fragment>}
            />

            <Grid item xs={12}>
                <EnhancedTable
                    title={"Incident List"}
                    schema={[
                        {id: 'id', label: 'Id', hidden: true},
                        {id: 'incidentNum', label: 'No.', sort: true},
                        {id: 'incidentDate', label: 'Date', sort: true},
                        {id: 'incidentTime', label: 'Time', sort: true},
                        {id: 'vehicleNum', label: 'Vehicle No.', sort: true},
                        {id: 'vehicleName', label: 'Vehicle Name', sort: true},
                        {id: 'location', label: 'Location', sort: true},
                        {id: 'reportedBy', label: 'Reported By', sort: true},
                        {id: 'downloadReport', label: 'Download Report', sort: true},
                        {id: 'actions', label: 'Actions', type: 'render', render: renderEditDeleteActions}
                    ]}
                    data={[]}
                    selection
                    pagination={false}
                    actions={[
                        {id: "downloadExcel", tooltip: "Download Excel", icon: CloudDownloadRounded}
                    ]}
                />
            </Grid>
        </Grid>
    );
};

export default IncidentReport;
